package com.itheima.aop;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @author robin
 * @version 1.0
 */
@Component
@Aspect
public class UserAspect {

    @Pointcut("execution(* com.itheima.aop.UserServiceImpl.*(..))")
    public void myPointcut() {
    }

    @Before("myPointcut()")
    public void start() {
        System.out.println("前置通知: 开启事务");
    }

    @After("myPointcut()")
    public void commit() {
        System.out.println("最终通知: 提交事务");
    }
}
